<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite + Vue + TS</title>
  </head>
  <body>
    <img id="background" src="" alt="">
    <div id="app"></div>
    <script type="module" src="/src/main.ts"></script>
  </body>
  <script>
    const ipcRenderer = require('electron').ipcRenderer;

    ipcRenderer.on('wallpaper', function(event, arg) {
      const background = document.querySelector('#background')
      background.src = `file://${arg.wallpaper}`
      background.width = arg.width + 20
      background.height = arg.height + 70
      background.style.top = `${arg.top <= 30 ? '' : '-'}${Math.abs(arg.top - 30)}px`
      background.style.left = `${arg.left < 0 ? '' : '-'}${Math.abs(arg.left)}px`
    });
    ipcRenderer.send('asynchronous-message', 'ping');
  </script>
</html>
